{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "77b8c394",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "\n",
    "\n",
    "def fun(x):\n",
    "    arr = np.arange(x)\n",
    "    np.random.shuffle(arr)\n",
    "    arr = arr[:5] + 1\n",
    "    return np.sort(arr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "0a9b5631",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 3,  7, 10, 12, 20])"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fun(21)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "0a8eb280",
   "metadata": {},
   "outputs": [],
   "source": [
    "class Worker:\n",
    "    def __init__(self, name, pay):\n",
    "        self.name = name\n",
    "        self.pay = pay\n",
    "    \n",
    "    def lastName(self):\n",
    "        return self.name.split(\" \")[-1]\n",
    "    \n",
    "    def giveRaise(self, percent):\n",
    "        self.pay = self.pay * (1 + percent)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "8506cd85",
   "metadata": {},
   "outputs": [],
   "source": [
    "w = Worker (\"Miao Fan\", 1000)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "a0d3b89c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Fan'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "w.lastName()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "098f3f87",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1000"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "w.pay"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "64502a57",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Miao Fan'"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "w.name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "b3a00408",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1100.0"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "w.giveRaise(0.1)\n",
    "w.pay"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "48f75c30",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
